import request from "@/utils/request.js";

// 用户收藏的单词|学会的单词
export function userListWord(data) {
	return request({
		url: '/word/getUserWord',
		method: 'post',
		data,
		isLoading: true
	})
}


export function getUserListWord(data) {
	return request({
		url: '/user/selectwords',
		method: 'post',
		data,
		isLoading: true
	})
}


// 需要复习的单词(课本)
export function reviewWordBook(bookId) {
	return request({
		url: '/word/getWord/' + bookId,
		method: 'get',
	})
}

// 需要复习的单词(计划)
export function reviewWordPlan(planId) {
	return request({
		url: '/word/getWordsByPlan/' + planId,
		method: 'get',
	})
}

// 需要学习的单词（计划）
export function wordByPlan(planId) {
	return request({
		url: '/word/getWordByPlan/' + planId,
		method: 'get',
	})
}

// 查询单词
export function searchWord(wordId) {
	return request({
		url: '/word/queryWord/' + wordId,
		method: 'get',
		isLoading: true
	})
}

// 查询单词列表
export function listWord(data) {
	return request({
		url: '/word',
		method: 'post',
		data
	})
}

// 记单词
export function reciteWord(data) {
	return request({
		url: '/word/addWord',
		method: 'post',
		data,
		isLoading: true
	})
}

// 读单词
export function readWord(word, file) {
	return request({
		url: `/studyWord/readWord?word=${word}&file=${file}`,
		method: 'post',
		isLoading: true
	})
}

//开始拼读 学
export function spellingStudy(type,data) {
	return request({
		url: '/studyWord/study/'+type,
		method: 'post',
		data,
		isLoading: true
	})
}

//练
export function wordTrain(data) {
	return request({
		url: '/studyWord/train',
		method: 'post',
		data,
		isLoading: true
	})
}

//检查
export function wordTrainCheck(data) {
	return request({
		url: '/studyWord/checktrain',
		method: 'post',
		data,
		isLoading: true
	})
}

// 加入收藏
export function addCollect(wordDetail) {
	return request({
		url: `/user/addWords`,
		method: 'post',
		data:wordDetail,
		isLoading: true,
	})
}
//加入难词库 

export function addHard(data) {
	return request({
		url: `/user/addHardwords`,
		method: 'post',
		data,
		isLoading: true,
	})
}

//难词列表
export function getHardList(data) {
	return request({
		url: '/user/selectHardwords',
		method: 'post',
		data,
		isLoading: true
	})
}

//是否收藏
export function getStatus(wordId) {
	return request({
		url: '/studyWord/selectStatus/'+wordId,
		method: 'get',
		isLoading: true
	})
}

//取消收藏
export function cancelStatus(wordId) {
	return request({
		url: '/studyWord/cancelCollect/'+wordId,
		method: 'get',
		isLoading: true
	})
}
//取消难单词
export function cancelHardWord(wordId) {
	return request({
		url: '/user/cancelHardwords/'+wordId,
		method: 'get',
		isLoading: true
	})
}


//取消难单词
export function getHardStatus(wordId) {
	return request({
		url: '/user/selectHardStatus/'+wordId,
		method: 'get',
		isLoading: true
	})
}